import router  from "./index";
// import store from "../store"

router.beforeEach((to,from,next) => {
    if(from.path != '/login' && from.path !='/' && to.path === '/login'){
        window.location.reload();
        return next();
    }

    if(to.path == '/login') {
        return next();
    }

    let token = localStorage.getItem('token');
    if(!token){
        return next('/login');
    }
    return next();
})